<?php
require_once("conf/db_connection.php");
$trip = $_GET['trip'];
$trucker = $_GET['trucker'];
$truck = $_GET['truck'];

$gen_tas = "";
$conf_prefix = "TAS#";
$conf_zero = 10;
$num_zero = $conf_zero - strlen($trip);

while($num_zero>0)
{
	$zero .= '0';
	$num_zero--;
}
$gen_tas = $conf_prefix.$zero.$trip;

$query_update = "UPDATE trip_detail SET tas_number='".$gen_tas."',trucker_id='".$trucker."',truck_id='".$truck."',status='for confirmation' WHERE id='".$trip."'";
mysql_query($query_update) or die("UPDATE TRIP DETAILS ".mysql_error());

$query_insert = "INSERT INTO status_log (trip_detail_id, status,updated_by) VALUES
('".$trip."','for confirmation','".$_SESSION["username_nn"]."')";
mysql_query($query_insert) or die("INSERT STATUS LOG".mysql_error());

echo "1";
?>